package jk;

public class maopao {
    static int a[] = {21,8,3,7,9,48,26,29,84,100};

    public static void main(String[] args){
        print();
        sort1();
        print();
    }

    public static void print(){
        for(int i=1 ; i<a.length ; i++){
            System.out.print(a[i]+"\t");
        }
        System.out.println();
    }

    public static void sort(){
        for(int j=a.length-2;j>1;j--){
            for(int k=0;k<=j;k++){
                if(a[k]>a[k+1]){
                    a[k] = a[k] + a[k+1];
                    a[k+1] = a[k] - a[k+1];
                    a[k] = a[k] - a[k+1];
                }
            }
        }
    }

    public static void sort1(){
        for(int j=0;j<a.length;j++){
            for(int k=0;k<a.length-j-1;k++){
                if(a[k]>a[k+1]){
                    a[k] = a[k] + a[k+1];
                    a[k+1] = a[k] - a[k+1];
                    a[k] = a[k] - a[k+1];
                }
            }
        }
    }


}
